var express = require('express');
var router = express.Router();
var path = require('path');

// 定义一个路由级别的中间件
function currentTime(req,res,next) {
  req.nowTime = new Date();
  next()
}

router.use(currentTime)

/* GET home page. 路由 */
router.get('/', function(req, res, next) {
  // res.render('index', { title: 'Express' });
  console.log("/index",req.nowTime);
  res.sendFile(path.join(__dirname,"../views/index.html"))
  
});

module.exports = router;
